class Solution4 {
    public int peakIndexInMountainArray(int[] arr) {
        int left = 0,right = arr.length;
        while(left < right) {
            int mid = left + (right -left + 1) / 2;
            if(arr[mid-1] < arr[mid]) {
                left = mid;
            }else {
                right = mid - 1;
            }
        }
        return left;
    }
}